export function isAttached(element) {
    let currentNode = element.parentNode;
    while (currentNode) {
        if (currentNode.tagName === 'HTML') {
            return true;
        }
        if (currentNode.nodeType === 11) {
            return false;
        }
        currentNode = currentNode.parentNode;
    }
    return false;
}

export function findNodeInParents(el, nodeName) { //eslint-disable-line
    let c = el.parentNode;
    while (c) {
        if (c.tagName === nodeName) return c;
        if (c.nodeType === 11) return null;
        c = c.parentNode;
    }
    return null;
}


